package demoMod.stsconsole.cards.red;

import demoMod.stsconsole.cards.AbstractCard;
import demoMod.stsconsole.characters.AbstractPlayer;
import demoMod.stsconsole.core.AbstractCreature;
import demoMod.stsconsole.utils.CardSelect;

import java.util.List;

public class BurningPact extends AbstractCard {
    public static final String ID = "BurningPact";

    public BurningPact() {
        super(ID);
        this.color = CardColor.RED;
        this.cost = 1;
        this.rarity = CardRarity.UNCOMMON;
        this.type = CardType.SKILL;
        this.target = CardTarget.SELF;
        this.magicNumber = 2;
    }

    @Override
    public void upgrade() {
        if (!this.upgraded) {
            this.upgraded = true;
            this.name = this.name + "+";
            this.upgradeTimes++;
            this.magicNumber = 3;
        }
    }

    @Override
    public boolean use(AbstractPlayer p, AbstractCreature target) {
        List<AbstractCard> cards = CardSelect.selectCards(p.hand, 1, c -> c != BurningPact.this, false);
        if (!cards.isEmpty()) {
            p.exhaustCard(cards.get(0), p.hand);
        }
        p.draw(this.magicNumber);
        return true;
    }
}
